﻿using BuildWheel;
using UnityEngine;
using UnityEngine.UIElements;

namespace UI.Inspector
{
    public class BaseInspector
    {
        protected VisualElement inspector;
        protected VisualElement uiElement;
        protected Transform transform;
        public string key;

        public BaseInspector(Transform _tf,VisualElement _inspector, string _key)
        {
            transform = _tf;
            key = _key;
            inspector = _inspector;
            
            uiElement = inspector?.Q<VisualElement>(key);
       
            _tf.GetComponent<global::Inspector>().typeDic[_key] = this;
            Hide();
        }

        public void Show()
        {
            uiElement.style.display = DisplayStyle.Flex;
        }

        public void Hide()
        {
            uiElement.style.display = DisplayStyle.None;
        }

        public virtual void Ref(File file)
        {
        }
        
        public virtual void Ref(GameObject go)
        {
        }
    }
}